﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace zichan.Entity
{
    public class ServerInfo
    {
        [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
        public int AssetId { get; set; }
        [Required(ErrorMessage ="品牌不能为空")]
        public string Brand { get; set; }
        [Required(ErrorMessage ="型号不能为空")]
        public string Version { get; set; }
        [Required(ErrorMessage ="序列号不能为空")]
        public string SerialNumber { get; set; }
        [Required(ErrorMessage ="U数不能为空")]
        [RegularExpression(@"^\+?[1-9]\d*$", ErrorMessage = "必须大于0")]
        public int U_Number { get; set; }
        [Required(ErrorMessage ="CPU必填")]
        public string CPU { get; set; }
        [Required(ErrorMessage ="内存必填")]
        public string Memory { get; set; }
        [Required(ErrorMessage ="硬盘必填")]
        public string HardDisk { get; set; }
        [Required(ErrorMessage ="RAID卡不能为空")]
        public string HardWareRAID { get; set; }
        [Required(ErrorMessage ="网口必填")]
        public string Comb { get; set; }
        [Required(ErrorMessage ="出厂时间必填")]
        [RegularExpression(@"^(\d{4})/(\d{1}|1[0-2])/(\d{1}|[12]\d{1}|3[01])((\s\d{1}|1\d{1}|2[0-3]):[0-5]\d{1}:([0-5]\d{1}))?$", ErrorMessage = "请输入正确的时间格式，如：2016/1/1")]
        public DateTime DeliveryTime { get; set; }
        [Required(ErrorMessage ="过保时间必填")]
        [RegularExpression(@"^(\d{4})/(\d{1}|1[0-2])/(\d{1}|[12]\d{1}|3[01])((\s\d{1}|1\d{1}|2[0-3]):[0-5]\d{1}:([0-5]\d{1}))?$", ErrorMessage = "请输入正确的时间格式，如：2016/1/1")]
        public DateTime WarrantyTime { get; set; }
        /// <summary>
        ///管理员
        /// </summary>
        public int? AdminiStratorId { get; set; }
        [NotMapped]
        public string AdminiStratorName { get; set; }
        /// <summary>
        /// 0为未完善信息，不可入库
        /// 1为已完善信息，可入库
        /// </summary>
        [NotMapped]
        public int IsStorage { get; set; }

    }
}
